- content_for :head do
  = javascript_include_tag  'mootools-1.2.1-core.js'
  = javascript_include_tag  'mootools-1.2-more.js'
  %script{:type => "text/javascript"}
    = "window.addEvent('domready', function() {"
    = " var stretchers = $$('div.settings');"
    = " var togglers = $$('h2.setting_heading');"
    = " var accordion = new Accordion(togglers, stretchers, {"
    = "   alwaysHide:true,"
    = "   display:99,"
    = "   opacity: true,"
    = "   onActive: function(togglers, stretchers){"
    = "     togglers.setStyle('background', '#1b1b1b'),"
    = "     togglers.setStyle('border', '1px solid #505050');"
    = "     togglers.setStyle('color', '#FFFFFF');"
    = "   },"
    = "   onBackground: function(togglers, stretchers){"
    = "     togglers.setStyle('background-color', '#0b0b0b');"
    = "     togglers.setStyle('border', '1px solid #1b1b1b');"
    = "     togglers.setStyle('color', '#CCCCCC');"
    = "   }"
    = " }, $('content'));"
    = "});"
%h1.page_title Site Settings
%h2.setting_heading Edit Menu Items
%div.settings
  - @menu_items.each do |menu_item|
    %table.menu_item
      - form_for menu_item, :method => :update do |form|
        %tr
          %td.field_title Menu item:
          %td.field= form.text_field    :item
          %td.field_title Links to:
          %td.field= form.text_field    :link
          %td.submit= submit_tag 'update'
        %tr
          %td
          %td.error= error_message_on   :menu_item, :item
          %td
          %td.error= error_message_on   :menu_item, :link
    - form_for menu_item, :html => {:method => 'delete'} do |form|
      %div.delete_menu_item= submit_tag 'delete'
  - form_for @menu_item, menus_url do |form|
    %table.new_menu_item
      %tr
        %td.title{:colspan => 2} ...or add a new new one
      %tr
        %td.field_title Menu item:
        %td.field= form.text_field :item
        %td.field_title Links to:
        %td.field= form.text_field   :link
        %td.submit= submit_tag 'add'
      %tr
        %td
        %td.error= error_message_on :menu_item, :item
        %td
        %td.error= error_message_on :menu_item, :link
%hr
%h2.setting_heading Edit Photo Sizes
%div.settings
  - @photo_sizes.each do |photo_size|
    %table.photo_size
      - form_for photo_size, photo_sizes_url do |form|
        %tr
          %td.field_title Photo Size:
          %td.field= form.text_field  :size
          %td.field_title Cost:
          %td.field= form.text_field  :cost
          %td.field_title Price List:
          %td.field
            %select{:name => "photo_size[price_list_id]"}
              %option{:value => ''} not set
              - @price_lists.each do |price_list|
                %option{:value => price_list.id, :selected => ('selected' if price_list == photo_size.price_list)}= price_list.name
          %td.submit= submit_tag 'update'
        %tr
          %td
          %td.error= error_message_on :photo_size, :name
          %td
          %td.error= error_message_on :photo_size, :cost
    - form_for photo_size, :html => {:method => 'delete'} do |form|  
      %div.delete_photo_size= submit_tag 'delete'
  - form_for @photo_size, photo_sizes_url do |form|
    %table.new_photo_size
      %tr
        %td.title{:colspan => 2} ...or add a new photo size
      %tr
        %td.field_title Photo Size:
        %td.field= form.text_field  :size
        %td.field_title Cost:
        %td.field= form.text_field  :cost
        %td.field_title Price List:
        %td.field
          %select{:name => "photo_size[price_list_id]"}
            %option{:value => ''} not set
            - @price_lists.each do |price_list|
              %option{:value => price_list.id}= price_list.name
        %td.submit= submit_tag 'add'
      %tr
        %td
        %td.error= error_message_on :photo_size, :size
        %td
        %td.error= error_message_on :photo_size, :cost
%hr
%h2.setting_heading Edit Item Options
%div.settings
  %p Item options that are for videos don't need to have a Price List associated with them since Price Lists are really only for Photo Size prices and videos have no Photo Sizes.
  - @item_options.each do |item_option|
    %table.item_option
      - form_for item_option, item_options_url do |form|
        %tr
          %td.field_title Name:
          %td.field= form.text_field  :name
          %td.field_title Cost:
          %td.field= form.text_field  :cost
          %td.field_title Price List:
          %td.field
            %select{:name => "item_option[price_list_id]"}
              %option{:value => ''} not set
              - @price_lists.each do |price_list|
                %option{:value => price_list.id, :selected => ('selected' if item_option.price_list == price_list)}= price_list.name
          %td.field_title
            For videos:
            %br
            For photos:
          %td.check_box
            = radio_button_tag("item_option[for_video]", 1, item_option.for_video?)
            %br
            = radio_button_tag("item_option[for_video]", 0, item_option.for_photo?)
          %td.submit= submit_tag 'update'
        %tr
          %td
          %td.error= error_message_on :item_option, :name
          %td
          %td.error= error_message_on :item_option, :cost
          %td
          %td.error= error_message_on :item_option, :for_video
          %td
          %td.error= error_message_on :item_option, :for_photo
          %td
      - form_for item_option, :html => {:method => 'delete'} do |form|  
        %div.delete_item_option= submit_tag 'delete'
  %table.item_option
    - form_for @item_option, item_options_url do |form|
      %tr
        %td.title{:colspan => 9} ...or add a new new one
      %tr
        %td.field_title Name:
        %td.field= form.text_field  :name
        %td.field_title Cost:
        %td.field= form.text_field  :cost
        %td.field_title Price List:
        %td.field
          %select{:name => "item_option[price_list_id]"}
            %option{:value => ''} not set
            - @price_lists.each do |price_list|
              %option{:value => price_list.id}= price_list.name
        %td.field_title
          For videos:
          %br
          For photos:
        %td.check_box
          = radio_button_tag("item_option[for_video]", 1)
          %br
          = radio_button_tag("item_option[for_video]", 0)
        %td.submit= submit_tag 'create'
      %tr
        %td
        %td.error= error_messages_for :item_option
        %td
        %td.error= error_message_on :item_option, :cost
        %td
        %td.error= error_message_on :item_option, :for_video
        %td
        %td.error= error_message_on :item_option, :for_photo
        %td
%hr
%h2.setting_heading Edit Order Options
%div.settings
  - @order_options.each do |order_option|
    %table.order_option
      - form_for order_option, order_options_url do |form|
        %tr
          %td.field_title Name:
          %td.field= form.text_field  :name
          %td.field_title Cost:
          %td.field= form.text_field  :cost
          %td.field_title Available in Quantities:
          %td.check_box= check_box_tag("order_option[quantifiable]", 1, order_option.quantifiable?)
          %td.submit= submit_tag 'update'
        %tr
          %td
          %td.error= error_message_on :order_option, :name
          %td
          %td.error= error_message_on :order_option, :cost
          %td
          %td.error= error_message_on :order_option, :quantifiable
          %td
      - form_for order_option, :html => {:method => 'delete'} do |form|  
        %div.delete_order_option= submit_tag 'delete'
  %table.order_option
    - form_for @order_option, order_options_url do |form|
      %tr
        %td.title{:colspan => 7} ...or add a new new one
      %tr
        %td.field_title Name:
        %td.field= form.text_field  :name
        %td.field_title Cost:
        %td.field= form.text_field  :cost
        %td.field_title Available in Quantities:
        %td.check_box= check_box_tag("order_option[quantifiable]", 1, @order_option.quantifiable?)
        %td.submit= submit_tag 'create'
      %tr
        %td
        %td.error= error_message_on :order_option, :name
        %td
        %td.error= error_message_on :order_option, :cost
        %td
        %td.error= error_message_on :order_option, :quantifiable
        %td
%hr
%h2.setting_heading Edit Shipping Methods
%div.settings
  - @shipping_methods.each do |shipping_method|
    %table.shipping_method
      - form_for shipping_method, shipping_methods_url do |form|
        %tr
          %td.field_title Name:
          %td.field= form.text_field  :name
          %td.field_title Cost:
          %td.field= form.text_field  :cost
          %td.submit= submit_tag 'update'
        %tr
          %td
          %td.error= error_message_on :shipping_method, :name
          %td
          %td.error= error_message_on :shipping_method, :cost
          %td
      - form_for shipping_method, :html => {:method => 'delete'} do |form|  
        %div.delete_shipping_method= submit_tag 'delete'
  %table.shipping_method
    - form_for @shipping_method, shipping_methods_url do |form|
      %tr
        %td.title{:colspan => 7} ...or add a new new one
      %tr
        %td.field_title Name:
        %td.field= form.text_field  :name
        %td.field_title Cost:
        %td.field= form.text_field  :cost
        %td.submit= submit_tag 'create'
      %tr
        %td
        %td.error= error_message_on :order_option, :name
        %td
        %td.error= error_message_on :order_option, :cost
        %td
%hr
%h2.setting_heading Edit Price Lists
%div.settings
  - @price_lists.each do |price_list|
    %table.price_list
      - form_for price_list, price_lists_url do |form|
        %tr
          %td.field_title Name:
          %td.field= form.text_field  :name
          %td.submit= submit_tag 'update'
        %tr
          %td
          %td.error= error_message_on :price_list, :name
          %td
      - form_for price_list, :html => {:method => 'delete'} do |form|  
        %div.delete_price_list= submit_tag 'delete'
  %table.price_list
    - form_for @price_list, price_lists_url do |form|
      %tr
        %td.title{:colspan => 7} ...or add a new new one
      %tr
        %td.field_title Name:
        %td.field= form.text_field  :name
        %td.submit= submit_tag 'create'
      %tr
        %td
        %td.error= error_message_on :price_list, :name
        %td
%hr
%h2.setting_heading Random Photos and Videos
%div.settings
  %h2 Photos
  - @random_photos.each do |photo|
    %table.photo
      %tr
        %td.photo
          %a{:href => edit_photo_url(photo), :title => (photo.caption ? photo.caption : photo.filename), :alt => (photo.caption ? photo.caption : photo.filename)}
            %img.photo_thumb{:src => photo.public_filename(:thumb), :title => (photo.caption ? photo.caption : photo.filename), :alt => (photo.caption ? photo.caption : photo.filename)}
  %h2 Videos
  - @random_videos.each do |video|
    %table.index_video
      %tr
        %td.video_preview
          %a{:href => edit_video_url(video), :title => video.title, :alt => video.title}
            %img.photo_thumb{:src => video.thumbnail, :title => video.title, :alt => video.title}
      %tr
        %td.video_title= video.title